<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>Title</title>
    <link rel="stylesheet" href="../static/plugins/layui/css/layui.css">
</head>
<style>
    .ok-body {
        padding: 10px
    }
</style>

<body>
<div class="ok-body">

    <div class="layui-row" style="margin-top: 15px">
        <form class="layui-form" action="">
            <label class="layui-form-label">规格名称</label>
            <div class="layui-input-inline">
                <input class="layui-input"  id="searchValue"  autocomplete="off">
            </div>
            <button class="layui-btn  layui-btn-normal" style="margin-left: 10px" lay-submit lay-filter="search">搜索</button>
        </form>
    </div>

    <hr class="layui-bg-orange">

    <table class="layui-hide" id="damageComponent" lay-filter="damageComponent"></table>
    <!--分页Div-->
    <div id="pageDiv"></div>

</div>

<script src="../static/plugins/layui/layui.js"></script>
<script src="../static/js/jquery-3.2.1.min.js"></script>
<script src="../static/js/jquery.base64.js"></script>
<script src="../static/js/device.js"></script>

<script th:inline="none">
    layui.use(['table','laypage','form'], function(){

        var table = layui.table;
        var form = layui.form;

        var tableName = 'damageComponent';

        var tableRenderObject = {
            elem: '#'+tableName
            ,title: '更换零件'
            ,tableName:tableName
            ,requestUrl:'/damageComponent/easyDamage'
            ,initParam:''
            ,defaultToolbar: ['filter', 'print']
            ,toolbar: true
            ,cols: [[
                {field:'name', title:'配件名称规格',align:'center'}
                ,{field:'unit', title:'单位',align:'center'}
                ,{field:'count', title:'更换次数',align:'center'}
                ,{field:'total', title:'更换数量',align:'center'}
            ]]
        };

        var myTable = new JJZ.MyTable(tableRenderObject);

        form.on('submit(search)', function(data){
            var searchValue = $('#searchValue').val();
            var param = "searchCol=name&searchValue="+searchValue;
            tableRenderObject.initParam = param;
            myTable.render();
            return false;
        });

    });

</script>
</body>
</html>